<template>
	<!-- 返回头部 -->
	<view class="to_top" @click="toTop">
		<uni-icons type="arrow-up" size="20" color="orange"></uni-icons>
		<view>顶部</view>
	</view>
</template>

<script setup>
	// 返回顶部
	const toTop = (() => {
		uni.pageScrollTo({
			scrollTop: 0,
			duration: 300
		})
	})
</script>

<style lang="less">
	.to_top {
		position: fixed;
		bottom: 200rpx;
		right: 20rpx;
		z-index: 99;
		border-radius: 50%;
		width: 80rpx;
		height: 80rpx;
		display: flex;
		flex-direction: column;
		font-size: 26rpx;
		justify-content: center;
		align-items: center;
		border: 1px solid #000;
		background-color: #ffffff50;
	}
</style>